using System;
using System.Diagnostics.Contracts;
using System.Linq.Expressions;

namespace Charisma.MongoDb.Linq.Expressions
{
  public abstract class MongoExpression : Expression
  {
    private readonly MongoExpressionType nodeType;
    private readonly Type type;

    public sealed override ExpressionType NodeType
    {
      get { return ExpressionType.Extension; }
    }

    public MongoExpressionType MongoNodeType 
    { 
      get { return nodeType; } 
    }

    public sealed override Type Type
    {
      get { return type; }
    }

    protected MongoExpression(MongoExpressionType nodeType, Type type)
    {
      Contract.Requires(type != null);

      this.nodeType = nodeType;
      this.type = type;
    }
  }
}